package cn.sxgan.db.mappers;


import cn.sxgan.common.entity.SysUser;
import cn.sxgan.common.entity.query.SysUserQuery;
import cn.sxgan.common.entity.vo.SysUserAndRoleVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
    
    List<SysUser> selectUserByCondition(SysUserQuery sysUserQuery);
    
    /**
     * 查询最大用户ID
     *
     * @return 最大用户id
     */
    Long selectMaxUserId();
    
    /**
     * 批量插入用户
     *
     * @param users 用户数据
     */
    void batchInsertUser(@Param("users") List<SysUser> users);
    
    /**
     * 查询用户及其角色信息
     *
     * @return 用户角色集合
     */
    List<SysUserAndRoleVO> selectUserAndRole(SysUserQuery sysUserQuery);
    
    int bindUserAndRole(Long userId, Long roleId);
}